package com.syxbbs.forum.controller;


import com.syxbbs.forum.common.AppResult;
import com.syxbbs.forum.exception.ApplicationException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//表示返回的结果是数据
@RestController
//定义映射路径
@RequestMapping("/test")
public class TestController {
    @RequestMapping("/hello")
    public String hello(){

        return "hello";
    }
    @GetMapping("appException")
    public AppResult applicationException(){
        throw new ApplicationException("这是一个app异常");
    }
    @GetMapping("/exception")
    public AppResult exception() throws Exception {
        throw new Exception("这是一个Exception");
    }

}
